package com.bauer.batch.reader;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.NonTransientResourceException;
import org.springframework.batch.item.ParseException;
import org.springframework.batch.item.UnexpectedInputException;

/**
 * @description:
 * @author: weirui
 * @create: 2020-07-28 17:07
 **/
public class TxtReader implements ItemReader<String[]> {

    private static Integer i = 0;

    @Override
    public String[] read()
        throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {

        System.out.println(Thread.currentThread().getName());
        if (i == 5) {
            return null;
        }
        System.out.println("read");
        List<String[]> list = new ArrayList<>();
        i++;
        return new String[]{"xxx", "xx"};
    }
}
